package com.sxpi.course.service.category;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sxpi.course.mapper.CategoryMapper;
import com.sxpi.course.pojo.Category;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: 董伟豪
 * @Date: 2022/10/13 14:53
 */
@Service
@Slf4j
public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> implements ICategoryService {

    @Override
    public List<Category> findCategories() {
        LambdaQueryWrapper<Category> categoryLambdaQueryWrapper = new LambdaQueryWrapper<>();
        categoryLambdaQueryWrapper.eq(Category::getStatus,1);
        categoryLambdaQueryWrapper.eq(Category::getIsdelete,0);
        // 方便排深顺
        categoryLambdaQueryWrapper.orderByAsc(Category::getSorted);
        return this.list(categoryLambdaQueryWrapper);
    }


}
